//
//  HZHttpFileData.m
//  Expert
//
//  Created by 刘华舟 on 15/4/3.
//  Copyright (c) 2015年 BLUEBLACK. All rights reserved.
//

#import "HZHttpFileData.h"
#import "NSDate+Conveniently.h"

@implementation HZHttpFileData

- (NSString *)fileName{
    if(_fileName == nil || _fileName.length == 0){
        _fileName = [[NSDate date] stringWithFormat:@"yyyyMMddHHmmss"];
    }
    return _fileName;
}

- (NSString *)parameterName{
    if(_parameterName == nil || _parameterName.length == 0){
        _parameterName = @"parameterName";
    }
    return _parameterName;
}

+ (instancetype)fileWithData:(NSData *)data name:(NSString *)name fileName:(NSString *)fileName mimeType:(NSString *)mimeType{
    return [[self alloc] initWithData:data name:name fileName:fileName mimeType:mimeType];
}

- (instancetype)initWithData:(NSData *)data name:(NSString *)name fileName:(NSString *)fileName mimeType:(NSString *)mimeType{
    if(self = [super init]){
        self.data = data;
        self.parameterName = name;
        self.fileName = fileName;
        self.mimeType = mimeType;
    }
    return self;
}

@end
